home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / infoserv / gopher / Unix / GopherTools / gmv.Z / gmv
Encoding:
Text File  |  1993-09-23  |  774 b   |  43 lines

  1. #!/bin/sh
  2. # gmv, boone, 02/15/93
  3. # Move gopher documents with their .cap files
  4. # Copyright (C) 1993, Trustees of Michigan State University
  5.  
  6. if [ $# -ne 2 ]
  7. then
  8.     echo "Usage: $0 source dest"
  9.     exit 1
  10. fi
  11.  
  12. # If input file/directory exists
  13.  
  14. if [ \( -f $1 \) -o \( -d $1 \) ]
  15. then
  16.     # Output must be a directory
  17.     if [ ! -d $2 ]
  18.     then
  19.         echo "$0: Destination must be a directory"
  20.         exit 2
  21.     fi
  22.     echo "$0: Moving $1 to $2"
  23.     mv $1 $2
  24.     indir=`dirname $1`
  25.     indir=${indir-`pwd`}
  26.     infile=`basename $1`
  27.     incap="$indir/.cap/$infile"
  28.     outcapdir="$2/.cap"
  29.     outcap="$2/.cap/$infile"
  30.     if [ -f $incap ]
  31.     then
  32.         if [ ! -d $outcapdir ]
  33.         then
  34.             mkdir $outcapdir
  35.         fi
  36.         echo "$0: Moving .cap file $incap to $outcap"
  37.         mv $incap $outcap
  38.     fi
  39. else
  40.     echo "$0: Input file $1 does not exist"
  41.     exit 2
  42. fi
  43.